package edu.study.module.student.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.ultrawise.survey.core.base.BaseContoller;
import com.ultrawise.survey.core.base.ServiceException;

import edu.study.module.student.service.StudentInfoService;
import edu.study.module.student.vo.StudentInfo;

@Controller
@RequestMapping("/student")
public class StudentInfoControl extends BaseContoller {
	
	@Autowired
	StudentInfoService studentInfoService ;

	@RequestMapping(value="querystudent")
	public ModelAndView queryStudent(StudentInfo st){
		//查询操作
		List<StudentInfo> ls = studentInfoService.queryStudent(st);
		
		return new ModelAndView("/study/studentinfo","stlist",ls);
	}
	
	
	public String editStudent(StudentInfo st,HttpServletRequest request){
		StudentInfo us = new StudentInfo();
		try {
			us= (StudentInfo) studentInfoService.queryByID(st.getId(), st, StudentInfo.class);
			
			request.setAttribute("student", us);
		} catch (ServiceException e) {
			System.out.println("没有该数据");
		}
		return "/study/studentedit";
	}
}
